<?php
/**
 *
 * Django's templating engine (partial) PHP implementation : tag now
 * {% now "format" %} see PHP date() for format
 * @link http://docs.djangoproject.com/en/dev/ref/templates/builtins/#now
 * this file is from a webappkit package (kit)
 * @link http://webappkit.net
 * @package djtpl
 * @author J.Ducastel <nospam0@ducastel.name>
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 */

class djtplTagNode_now extends djtplTagNode {

    /**
    * builds itself from tokens
    * @param djangoTplToken &$selfToken
    * @param array &$nextTokens djangoTplToken
    * @access public
    * @return bool
    */
    function buildFromTokens(&$selfToken) {
        $def = $selfToken->tagdef;
        // wiping " enclosures
        $this->format = substr(trim($def), 1, -1);
        return true;
    }/**/

    /**
    * is the node atomic (has no children)
    * @access public
    * @return bool
    */
    function isAtomic() {
        return true;
    }/**/

    /**
    * renders node to string
    * @param
    * @access public
    * @return string
    */
    function render(&$context) {
        return date($this->format);
    }/**/
/*------------------------------------------------------------------------------
                                                                      properties
------------------------------------------------------------------------------*/
    /**
    * @var array values to cycle through
    */
    var $tagname='now';
    /**
     * @var string date format as in PHP date()
     */
    var $format;
} /* end of djtpltagnode_cycle class */